# encoding: utf-8
# @project: st2111 
# @file: wordcloud_simple.py
# @time: 2023/3/2 14:18
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc: wordcloud 相关配置示例，
from wordcloud import WordCloud
import matplotlib.pyplot as plt

if __name__ == "__main__":
    text = "我 在 陕西 交通 职业 技术 学院 软件 技术 专业 学习，软件 技术 专业 的 课程 很 有趣！"
    font = "./fonts/msyh.ttc"

    # wc = WordCloud(font_path=font)
    # 配置词云的背景色为白色
    # wc = WordCloud(background_color="white", font_path=font)
    # wc = WordCloud(font_path=font, width=800, height=600, background_color="white")
    # wc = WordCloud(font_path=font, width=800, height=600, margin=20, background_color="white")
    # wc = WordCloud(font_path=font, width=800, height=600, scale=4, background_color="white")
    # wc = WordCloud(font_path=font, width=800, height=600, prefer_horizontal=0, background_color="white")
    # wc = WordCloud(font_path=font, width=800, height=600, min_font_size=12, max_font_size=128, background_color="white")
    # wc = WordCloud(font_path=font, width=800, height=600, font_step=4, background_color="white")
    wc = WordCloud(font_path=font, width=800, height=600, stopwords=["技术"], background_color="white")
    wc.generate(text=text)

    plt.imshow(wc, interpolation='bilinear')
    plt.axis("off")
    plt.show()

